<?php
session_start();
date_default_timezone_set("America/Sao_Paulo");
setlocale(LC_ALL, 'pt_BR');
include "../../../config/conexao.php";
include "../../../biblioteca/funcao.php";

extract($_POST);

if ($pai_id){
                    
    if ($pai_id > 0){
        
        $sql = "SELECT pai_nome FROM pais WHERE pai_id='$pai_id'";
        $res = sql($sql);
        $linha = mysql_fetch_array($res);
        $pais = " :: {$linha['pai_nome']}";

        $onde .= " WHERE eval.pai_id = '{$_POST['pai_id']}'";

    } else {

        $onde .= "";

    }

} else {

    $onde .= "";

}
?>
<html>
    
    <head>
        
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <link rel="stylesheet" type="text/css" href="../../../plugin/estilo.css">
        <link rel="stylesheet" type="text/css" href="../../../plugin/bootstrap/css/bootstrap-responsive.css">
        <link rel="stylesheet" type="text/css" href="../../../plugin/bootstrap/css/bootstrap.css"> 
        <script type="text/javascript" src="../../../plugin/jquery-1.7.2.js"></script>
        <script type="text/javascript" src="../../../plugin/bootstrap/js/bootstrap.min.js"></script>
        <script type="text/javascript" src="../../../plugin/funcao.js" /></script>

        <title>Imprimir</title>
        <link href="../../../midia/base/favicon.ico" rel="shortcut icon" type="image/x-icon" />
        <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
            <!--[if lt IE 9]>
            <script src="../../../plugin/html5.js"></script>
        <![endif]-->
        
        <style type="text/css">

            select { width: 200px !important;}

        </style>
            
    </head>
    
    <body>
        
        <div style="padding: 20px;">
            
            <h3>Immediate Evaluation Report <?=$pais;?>
            </h3>
            
            <p class="pull-right"><a href="#" onClick="window.print();"><i class="icon-print"></i> Imprimir</a></p>
            <p class="pull-right"><a href="#" onClick="window.close();"><i class="icon-print"></i> Fechar&nbsp;&nbsp;</a></p>
            
            <br>
            <hr>
            <form name="form" action="" method="post">
                
                <?php include "../../../mod/combo/pai_id.php";?> <input type="submit" name="botao" value="Buscar" class="btn">
                
            </form>
            <br>
            
            <table class="table table-striped table-bordered table-hover">
                
                <?php
                $sql = "SELECT * FROM eval 
                LEFT JOIN pais ON pais.pai_id=eval.pai_id
                INNER JOIN evalreport ON evalreport.eva_id=eval.eva_id $onde";
                $res = mysql_query($sql);
                while($linha = mysql_fetch_array($res)) {
                ?>
                
                <tr>   
                    <th><i class="icon-user"></i> <?=$linha['cli_nome'];?></th>    
                    <th width="200"><?=$linha['pai_nome'];?></th>   
                </tr>
                <?php
                    $sql_report= "SELECT * FROM evalreport WHERE eva_id='{$linha['eva_id']}'";
                    $res_report = sql($sql_report);
                    while($linha_report = mysql_fetch_array($res_report)){
                ?>
                <tr>
                    
                    <td colspan="2"><?=nl2br($linha_report['eva_rep_msg']);?></td>
                    
                </tr>  
                <?php 
                    }
                } 
                ?>
                
            </table>
   
                
        </div>
        
    </body>
    
</html>